import { Forward, PlayerInput as PlayerInput } from '../define/GameDefine';
import TableMgr from '../manager/TableMgr';

export default class Utils {
  public static isNull(obj: any): boolean {
    return obj == null || obj == undefined || obj == 'undefined';
  }

  public static getNow(): number {
    let time = new Date();
    return time.getTime();
  }

  public static getForwardByInput(input: number): Forward {
    switch (input) {
      case cc.macro.KEY.up:
        return Forward.Up;
      case cc.macro.KEY.down:
        return Forward.Down;
      case cc.macro.KEY.left:
        return Forward.Left;
      case cc.macro.KEY.right:
        return Forward.Right;
      default:
        return null;
    }
  }
}
